﻿using Dapper;
using Hangfire;
using Hangfire.Dashboard;
using Hangfire.Dashboard.BasicAuthorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading.Tasks;


namespace BgWorks.Common
{

    public static class HangfrieHelper
    {
        /// <summary>
        /// 获取当天月日时间戳
        /// </summary>
        /// <returns></returns>
        public static string GetTodayTimeSpan()
        {
            return "123";
            //string result = string.Empty;
            //DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
            //long timeStamp = (long)(Convert.ToDateTime(DateTime.Now.ToShortDateString()) - startTime).TotalMilliseconds;
            //result = timeStamp.ToString().Substring(4, 4);
            //return result;
        }

        public static BasicAuthAuthorizationFilter filter = new BasicAuthAuthorizationFilter(
              new BasicAuthAuthorizationFilterOptions
              {
                  SslRedirect = false,
                  RequireSsl = false,
                  LoginCaseSensitive = false,
                  Users = new[]
                  {
                        new BasicAuthAuthorizationUser
                        {
                            Login = "admin",
                            PasswordClear = GetTodayTimeSpan(),
                        },

                  }
              });
       
    }
}
